/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.vijayan.profile.model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

/**
 * @author vijayan
 */
public class MyPhotoClp extends BaseModelImpl<MyPhoto> implements MyPhoto {
	public MyPhotoClp() {
	}

	public long getPrimaryKey() {
		return _photoId;
	}

	public void setPrimaryKey(long pk) {
		setPhotoId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_photoId);
	}

	public long getPhotoId() {
		return _photoId;
	}

	public void setPhotoId(long photoId) {
		_photoId = photoId;
	}

	public long getProfileId() {
		return _profileId;
	}

	public void setProfileId(long profileId) {
		_profileId = profileId;
	}

	public String getContent() {
		return _content;
	}

	public void setContent(String content) {
		_content = content;
	}

	public int getWidth() {
		return _width;
	}

	public void setWidth(int width) {
		_width = width;
	}

	public int getHeight() {
		return _height;
	}

	public void setHeight(int height) {
		_height = height;
	}

	public String getType() {
		return _type;
	}

	public void setType(String type) {
		_type = type;
	}

	public boolean getThumbnail() {
		return _thumbnail;
	}

	public boolean isThumbnail() {
		return _thumbnail;
	}

	public void setThumbnail(boolean thumbnail) {
		_thumbnail = thumbnail;
	}

	public MyPhoto toEscapedModel() {
		if (isEscapedModel()) {
			return this;
		}
		else {
			return (MyPhoto)Proxy.newProxyInstance(MyPhoto.class.getClassLoader(),
				new Class[] { MyPhoto.class }, new AutoEscapeBeanHandler(this));
		}
	}

	public Object clone() {
		MyPhotoClp clone = new MyPhotoClp();

		clone.setPhotoId(getPhotoId());
		clone.setProfileId(getProfileId());
		clone.setContent(getContent());
		clone.setWidth(getWidth());
		clone.setHeight(getHeight());
		clone.setType(getType());
		clone.setThumbnail(getThumbnail());

		return clone;
	}

	public int compareTo(MyPhoto myPhoto) {
		long pk = myPhoto.getPrimaryKey();

		if (getPrimaryKey() < pk) {
			return -1;
		}
		else if (getPrimaryKey() > pk) {
			return 1;
		}
		else {
			return 0;
		}
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		MyPhotoClp myPhoto = null;

		try {
			myPhoto = (MyPhotoClp)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = myPhoto.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(15);

		sb.append("{photoId=");
		sb.append(getPhotoId());
		sb.append(", profileId=");
		sb.append(getProfileId());
		sb.append(", content=");
		sb.append(getContent());
		sb.append(", width=");
		sb.append(getWidth());
		sb.append(", height=");
		sb.append(getHeight());
		sb.append(", type=");
		sb.append(getType());
		sb.append(", thumbnail=");
		sb.append(getThumbnail());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(25);

		sb.append("<model><model-name>");
		sb.append("com.vijayan.profile.model.MyPhoto");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>photoId</column-name><column-value><![CDATA[");
		sb.append(getPhotoId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>profileId</column-name><column-value><![CDATA[");
		sb.append(getProfileId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>content</column-name><column-value><![CDATA[");
		sb.append(getContent());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>width</column-name><column-value><![CDATA[");
		sb.append(getWidth());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>height</column-name><column-value><![CDATA[");
		sb.append(getHeight());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>type</column-name><column-value><![CDATA[");
		sb.append(getType());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>thumbnail</column-name><column-value><![CDATA[");
		sb.append(getThumbnail());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _photoId;
	private long _profileId;
	private String _content;
	private int _width;
	private int _height;
	private String _type;
	private boolean _thumbnail;
}